home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Mac OS USB DDK / Examples / USBKeypad / USBKeypad.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-10  |  2.6 KB  |  100 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        USBKeypad.h
  3.  
  4.     Contains:    Header file for MacAlly TenKey Keypad Module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MacAllyTenKeyH__
  12. #define __MacAllyTenKeyH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <USB.h>
  19.  
  20. void     PostUSBKeyToMac(UInt16 rawUSBkey);
  21. void    PostADBKeyToMac(UInt16 virtualKeycode, UInt8 state);
  22.  
  23. void    USBDemoKeyIn(UInt32 refcon, void * theData);
  24. void    InitUSBKeyboard(void);
  25. void     KBDHIDNotification(UInt32 devicetype, UInt8 NewHIDData[], UInt8 OldHIDData[]);
  26.  
  27. Boolean    SetBit(UInt8 *bitmapArray, UInt16 index, Boolean value);
  28.  
  29. static     OSStatus    MacAllyTenKeyDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  30. static     OSStatus    MacAllyTenKeyInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  31. static     OSStatus    MacAllyTenKeyFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  32.  
  33. void    InitiateTransaction(USBPB *pb);
  34. void     TransactionCompletionProc(USBPB *pb);
  35.  
  36. void     DriverEntry(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  37.  
  38. void     ProcessInterruptReport(UInt8 hidReport[]);
  39.  
  40. #define kKeyboardRetryCount        3
  41. #define kKeyboardModifierBits    8
  42. #define kKeyboardReportKeys        2
  43. #define    kKeyboardOffsetToKeys    2
  44. #define kKeyboardReportSize        4
  45.  
  46. enum driverstages
  47. {
  48.     kUndefined = 0,
  49.     kSetKeyboardLEDs,
  50.     kFindInterface,
  51.     kOpenDevice,
  52.     kNewInterfaceRef,
  53.     kConfigureInterface,
  54.     kGetReportDescriptor,
  55.     kFindInterruptPipe,
  56.     kReadInterruptPipe,
  57.     kReturnFromDriver =     0x1000,
  58.     kRetryTransaction =     0x2000,
  59.     kSyncTransaction =         0x4000,
  60.     kCompletionPending =     0x8000
  61. };
  62.  
  63. typedef struct
  64. {
  65.     USBPB                             pb;
  66.     void (*handler)(USBPB             *pb);
  67.  
  68.     USBDeviceRef                    deviceRef;
  69.     USBInterfaceRef                    interfaceRef;
  70.     USBPipeRef                        pipeRef;
  71.     
  72.     USBDeviceDescriptor             deviceDescriptor;
  73.     USBInterfaceDescriptor            interfaceDescriptor;
  74.  
  75.     USBConfigurationDescriptorPtr     pFullConfigDescriptor;
  76.     USBInterfaceDescriptorPtr        pInterfaceDescriptor;
  77.     USBEndPointDescriptorPtr        pEndpointDescriptor;
  78.     
  79.     UInt32                            configurationNumber;
  80.     UInt32                            interfaceNumber;
  81.     
  82.     UInt32                            hidDeviceType;
  83.     
  84.     UInt32                            hidReportSize;
  85.     UInt8                            hidReport[8];
  86.     UInt8                            oldHIDReport[8];
  87.     UInt8                            padding[8];
  88.     UInt8                            hidReportDescriptor[256];
  89.     
  90.     Boolean                            sendRawReportFlag;
  91.     Boolean                            hidEmulationInit;
  92.     
  93.     UInt32                            interruptRefcon;
  94.     
  95.     SInt32                             retryCount;
  96.     SInt32                            delayLevel;
  97.     SInt32                            transDepth;
  98. } usbMacAllyPBStruct;
  99.  
  100. #endif //__MacAllyTenKeyH__